require 'rack/test'
require 'sinatra'
require 'ruby-hackernews'

require 'rhn/app'

# setup test environment
set :environment, :test
set :run, false
set :raise_errors, true
set :logging, false

def app
  RHN
end

RSpec.configure do |config|
  config.include Rack::Test::Methods
end

def mock_entry id, title, link, ccount, voting, user
  link = mock(Object, :title => title, :href => link)
  mock(RubyHackernews::Entry,
       :id => id,
       :link => link,
       :comments_count => ccount,
       :voting => mock(Object, :score => voting),
       :user => mock(Object, :name => user))
end
